package com.imu.core.redis;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * com.aloha.druid
 *
 * @author liyang
 * @name DruidProperties
 * @description
 * @date 2017-02-20 17:49
 *       <p>
 *       <p>
 *       aloha CO.,LTD. All Rights Reserved. 
 */
@ConfigurationProperties(prefix = "redis")
public class RedisProperties
{
	/***Redis服务主机***/
	private String host;
	/***Redis服务连接密码***/
	private String password;
	/***Redis服务端口号***/
	private int port;
	/***Redis服务数据库***/
	private int database;
	/***连超时设置***/
	private int timeout;
	/***连接池中最大连接数。高版本：maxTotal，低版本：maxActive***/
	private int maxTotal;
	/***连接池中最大空闲的连接数***/
	private int maxIdle;
	/***连接池中最少空闲的连接数***/
	private int minIdle;
	/***当连接池资源耗尽时，调用者最大阻塞的时间，超时将跑出异常。单位，毫秒数;默认为-1.表示永不超时。高版本：maxWaitMillis，低版本：maxWait***/
	private int maxWaitMillis;
	/***连接空闲的最小时间，达到此值后空闲连接将可能会被移除。负值(-1)表示不移除***/
	private int minEvictableIdleTimeMillis;
	/***对于“空闲链接”检测线程而言，每次检测的链接资源的个数。默认为3***/
	private int numTestsPerEvictionRun;
	/***“空闲链接”检测线程，检测的周期，毫秒数。如果为负值，表示不运行“检测线程”。默认为-1***/
	private int timeBetweenEvictionRunsMillis;
	/***是否打开连接池,是否使用连接池***/
    private boolean usePool;
	/***向调用者输出“链接”资源时，是否检测是有有效，如果无效则从连接池中移除，并尝试获取继续获取。默认为false。建议保持默认值***/
    private boolean testOnBorrow;
	/***向连接池“归还”链接时，是否检测“链接”对象的有效性。默认为false。建议保持默认值***/
    private boolean testOnReturn;
	/***向调用者输出“链接”对象时，是否检测它的空闲超时；默认为false。如果“链接”空闲超时，将会被移除。建议保持默认值***/
    private boolean testWhileIdle;
	/***当“连接池”中active数量达到阀值时，即“链接”资源耗尽时，连接池需要采取的手段, 默认为1(0:抛出异常。1:阻塞，直到有可用链接资源。2:强制创建新的链接资源)***/
    private int whenExhaustedAction;

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public int getDatabase() {
		return database;
	}

	public void setDatabase(int database) {
		this.database = database;
	}

	public int getTimeout() {
		return timeout;
	}

	public void setTimeout(int timeout) {
		this.timeout = timeout;
	}

	public int getMaxTotal() {
		return maxTotal;
	}

	public void setMaxTotal(int maxTotal) {
		this.maxTotal = maxTotal;
	}

	public int getMaxIdle() {
		return maxIdle;
	}

	public void setMaxIdle(int maxIdle) {
		this.maxIdle = maxIdle;
	}

	public int getMinIdle() {
		return minIdle;
	}

	public void setMinIdle(int minIdle) {
		this.minIdle = minIdle;
	}

	public int getMaxWaitMillis() {
		return maxWaitMillis;
	}

	public void setMaxWaitMillis(int maxWaitMillis) {
		this.maxWaitMillis = maxWaitMillis;
	}

	public int getMinEvictableIdleTimeMillis() {
		return minEvictableIdleTimeMillis;
	}

	public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
		this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
	}

	public int getNumTestsPerEvictionRun() {
		return numTestsPerEvictionRun;
	}

	public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
		this.numTestsPerEvictionRun = numTestsPerEvictionRun;
	}

	public int getTimeBetweenEvictionRunsMillis() {
		return timeBetweenEvictionRunsMillis;
	}

	public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) {
		this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
	}

	public boolean isUsePool() {
		return usePool;
	}

	public void setUsePool(boolean usePool) {
		this.usePool = usePool;
	}

	public boolean isTestOnBorrow() {
		return testOnBorrow;
	}

	public void setTestOnBorrow(boolean testOnBorrow) {
		this.testOnBorrow = testOnBorrow;
	}

	public boolean isTestOnReturn() {
		return testOnReturn;
	}

	public void setTestOnReturn(boolean testOnReturn) {
		this.testOnReturn = testOnReturn;
	}

	public boolean isTestWhileIdle() {
		return testWhileIdle;
	}

	public void setTestWhileIdle(boolean testWhileIdle) {
		this.testWhileIdle = testWhileIdle;
	}

	public int getWhenExhaustedAction() {
		return whenExhaustedAction;
	}

	public void setWhenExhaustedAction(int whenExhaustedAction) {
		this.whenExhaustedAction = whenExhaustedAction;
	}
}
